<template>
	<view class="filmDetail">
		
		<view class="nav">
			<uni-nav-bar :title="nav" backgroundColor="transparent" left-icon="left" @clickLeft="goback">
				<block slot="right">
					<image src="/static/film/detail_share.png" class="share_btn" @click="onShare"></image>
				</block>
			</uni-nav-bar>
		</view>
		
		
		<view class="detail">
			<view class="film">
				<image :src="data.pic" mode="aspectFill"></image>
				<view class="left flex_c" style="align-items: flex-start;">
					<view class="name">{{data.name}}</view>
					<view class="text">{{data.filmTypes}}</view>
					<view class="text"><text>{{data.movieArea}}</text><text>{{data.language || ''}}</text></view>
					<view class="btn">
						<uni-icons type="heart-filled" color="#FFF" :size="20"></uni-icons>
						<text>{{data.like}}人想看</text>
					</view>
				</view>
			</view>
			
			<view class="editor">
				<view class="title">简介</view>
				<view class="editor_content">
					{{data.intro}}
					<!-- <uni-icons type="down" size="20" color="#333" v-if="isHidden" @click="onHidden"></uni-icons>
					<uni-icons type="up" size="20" color="#333" v-if="!isHidden" @click="onHidden"></uni-icons> -->
				</view>
				<view class="hidden_btn">
					
				</view>
			</view>
			
			<view class="people">
				<view class="title">演职人员</view>
				<view class="text" v-if="data.director">导演：{{data.director}}</view>
				<view class="text hidden">主演：{{data.leading_role}}</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isHidden:true,
				data:{},
				showid:0,
				address:{},
				
				nav:'',
			}
		},
		methods: {
			goback(){ uni.navigateBack() },
			onHidden(){
				this.isHidden = !this.isHidden
			},
			getDetail(){
				this.request.httpTokenRequest({
					url: "/movie/read?filmld",
					method: "get"
				}, {
					filmId:this.id,
					cityCode:this.address.cityCode,
				}).then(res => {
					// console.log(res);
					if (res.code == 0) {
						this.data = res.data.filmInfo
					}else {
						this.$util.msg(res.msg)
					}
				}, error => {})
			},
			onShare(){
				this.request.httpTokenRequest({
					url: "index/getShareConfig",
					method: "get"
				}, {
					type:1
				}).then(data => {
					if (data.code == 0) {
						uni.share({
							provider: "weixin",
							scene: "WXSceneSession",
							type: 0,
							href: data.data.path + '?pid=' + uni.getStorageSync('user').id, // 跳转链接
							title: data.data.title, // 分享标题
							summary: data.data.content,
							imageUrl: data.data.image,
						});
					}else {
						this.$util.msg(data.msg)
					}
				}, error => {})
			},
		},
		onLoad(option) {
			this.id = option.id
			this.address = this.$store.state.movieLocation
			this.getDetail()
		}
	}
</script>

<style lang="scss" scoped>
	.nav {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		background: url(https://qiniu-cdn.maeiyun.com/imgs/indexbg.png) no-repeat 0 0;
		z-index: 99;
		padding-top: var(--status-bar-height);
	}
	.filmDetail {
		background: url(https://qiniu-cdn.maeiyun.com/imgs/indexbg.png) no-repeat 0 0;
		min-height: 100vh;
		box-sizing: border-box;
		padding: calc(var(--status-bar-height) + 44px) 30rpx 0;
		display: flex;
		flex-direction: column;
		.share_btn {
			width: 31rpx;
			height: 31rpx;
		}
	}
	.detail {
		padding: 30rpx 30rpx 43rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		.film {
			display: flex;
			align-items: center;
			padding-bottom: 32rpx;
			border-bottom: 1rpx solid #D3D3D3;
			image {
				width: 195rpx;
				height: 260rpx;
				margin-right: 30rpx;
			}
			.left {
				.name {
					font-size: 34rpx;
					font-weight: 600;
					color: #08090A;
					line-height: 48rpx;
					margin-bottom: 32rpx;
				}
				.text {
					font-size: 24rpx;
					color: #919191;
					line-height: 33rpx;
					margin-bottom: 20rpx;
					text {
						margin-right: 30rpx;
					}
				}
				.btn {
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding: 0 10rpx;
					box-sizing:border-box;
					height: 56rpx;
					background: linear-gradient(90deg, #FEAB33 0%, #F68B3D 100%);
					border-radius: 14rpx;
					text {
						font-size: 22rpx;
						color: #FFFFFF;
						line-height: 56rpx;
					}
				}
			}
		}
		.editor {
			padding: 31rpx 0 32rpx;
			border-bottom: 1rpx solid #D3D3D3;
			.title {
				font-size: 30rpx;
				color: #08090A;
				line-height: 42rpx;
				margin-bottom: 24rpx;
			}
			.editor_content {
				font-size: 26rpx;
				color: #08090A;
				line-height: 37rpx;
			}
			#hidden {
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp:4;
				-webkit-box-orient: vertical;
			}
			.hidden_btn {
				display: flex;
				flex-direction: row-reverse;
			}
		}
		.people {
			padding: 31rpx 0 0;
			.title {
				font-size: 30rpx;
				color: #08090A;
				line-height: 42rpx;
				margin-bottom: 24rpx;
			}
			.text {
				font-size: 26rpx;
				color: #08090A;
				line-height: 37rpx;
				margin-top: 30rpx;
			}
		}
	}
	button {
		width: 690rpx;
		height: 88rpx;
		background: #EF5233;
		border-radius: 44rpx;
		font-size: 28rpx;
		color: #FFFFFF;
		line-height: 88rpx;
		margin-top: 61rpx;
	}
</style>
